home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / ATA.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  54.2 KB  |  1,051 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ATA.h
  3.  
  4.      Contains:    ATA (PC/AT Attachment) Interfaces
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1995-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __ATA__
  19. #define __ATA__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __MIXEDMODE__
  25. #include <MixedMode.h>
  26. #endif
  27.  
  28.  
  29.  
  30. #if PRAGMA_ONCE
  31. #pragma once
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_STRUCT_ALIGN
  43.     #pragma options align=mac68k
  44. #elif PRAGMA_STRUCT_PACKPUSH
  45.     #pragma pack(push, 2)
  46. #elif PRAGMA_STRUCT_PACK
  47.     #pragma pack(2)
  48. #endif
  49.  
  50.  
  51. /* This is the structure used for the AT Interface core routines below */
  52.  
  53. enum {
  54.     kATATrap                    = 0xAAF1,                        /* Manager trap number <This should be defined in Traps.h>*/
  55.     kATAPBVers1                    = 0x01,                            /* parameter block version number 1*/
  56.     kATAPBVers2                    = 0x02,                            /* parameter block version number for structures*/
  57.     kATAPBVers3                    = 0x03,                            /* parameter block version for ATA times*/
  58.     kATADefaultBlockSize        = 512                            /* default block size*/
  59. };
  60.  
  61. /* Used to determine the presence of traps*/
  62.  
  63. enum {
  64.     kFSMTrap                    = 0xAC,
  65.     mDQEChanged                    = 1                                /* DQE has changed */
  66. };
  67.  
  68. /* Task file definition ••• Error Register •••*/
  69.  
  70. enum {
  71.     bATABadBlock                = 7,                            /* bit number of bad block error bit*/
  72.     bATAUncorrectable            = 6,                            /* bit number of uncorrectable error bit*/
  73.     bATAMediaChanged            = 5,                            /* bit number of media changed indicator*/
  74.     bATAIDNotFound                = 4,                            /* bit number of ID not found error bit*/
  75.     bATAMediaChangeReq            = 3,                            /* bit number of media changed request*/
  76.     bATACommandAborted            = 2,                            /* bit number of command abort bit*/
  77.     bATATrack0NotFound            = 1,                            /* bit number of track not found*/
  78.     bATAAddressNotFound            = 0,                            /* bit number of address mark not found*/
  79.     mATABadBlock                = 1 << bATABadBlock,            /* Bad Block Detected*/
  80.     mATAUncorrectable            = 1 << bATAUncorrectable,        /* Uncorrectable Data Error*/
  81.     mATAMediaChanged            = 1 << bATAMediaChanged,        /* Media Changed Indicator (for removable)*/
  82.     mATAIDNotFound                = 1 << bATAIDNotFound,            /* ID Not Found*/
  83.     mATAMediaChangeReq            = 1 << bATAMediaChangeReq,        /* Media Change Requested (NOT IMPLEMENTED)*/
  84.     mATACommandAborted            = 1 << bATACommandAborted,        /* Aborted Command*/
  85.     mATATrack0NotFound            = 1 << bATATrack0NotFound,        /* Track 0 Not Found*/
  86.     mATAAddressNotFound            = 1 << bATAAddressNotFound        /* Address Mark Not Found*/
  87. };
  88.  
  89. /* Task file definition ••• Features register •••*/
  90.  
  91. enum {
  92.     bATAPIuseDMA                = 0,                            /* bit number of useDMA bit (ATAPI)*/
  93.     mATAPIuseDMA                = 1 << bATAPIuseDMA
  94. };
  95.  
  96. /* Task file definition ••• ataTFSDH Register •••*/
  97.  
  98. enum {
  99.     mATAHeadNumber                = 0x0F,                            /* Head Number (bits 0-3) */
  100.     mATASectorSize                = 0xA0,                            /* bit 7=1; bit 5 = 01 (512 sector size) <DP4>*/
  101.     mATADriveSelect                = 0x10,                            /* Drive (0 = master, 1 = slave) */
  102.     mATALBASelect                = 0x40                            /* LBA mode bit (0 = chs, 1 = LBA)*/
  103. };
  104.  
  105. /* Task file definition ••• Status Register •••*/
  106.  
  107. enum {
  108.     bATABusy                    = 7,                            /* bit number of BSY bit*/
  109.     bATADriveReady                = 6,                            /* bit number of drive ready bit*/
  110.     bATAWriteFault                = 5,                            /* bit number of write fault bit*/
  111.     bATASeekComplete            = 4,                            /* bit number of seek complete bit*/
  112.     bATADataRequest                = 3,                            /* bit number of data request bit*/
  113.     bATADataCorrected            = 2,                            /* bit number of data corrected bit*/
  114.     bATAIndex                    = 1,                            /* bit number of index mark*/
  115.     bATAError                    = 0,                            /* bit number of error bit*/
  116.     mATABusy                    = 1 << bATABusy,                /* Unit is busy*/
  117.     mATADriveReady                = 1 << bATADriveReady,            /* Unit is ready*/
  118.     mATAWriteFault                = 1 << bATAWriteFault,            /* Unit has a write fault condition*/
  119.     mATASeekComplete            = 1 << bATASeekComplete,        /* Unit seek complete*/
  120.     mATADataRequest                = 1 << bATADataRequest,            /* Unit data request*/
  121.     mATADataCorrected            = 1 << bATADataCorrected,        /* Data corrected*/
  122.     mATAIndex                    = 1 << bATAIndex,                /* Index mark - NOT USED*/
  123.     mATAError                    = 1 << bATAError                /* Error condition - see error register*/
  124. };
  125.  
  126. /* Task file definition ••• Device Control Register •••*/
  127.  
  128. enum {
  129.     bATADCROne                    = 3,                            /* bit number of always one bit*/
  130.     bATADCRReset                = 2,                            /* bit number of reset bit*/
  131.     bATADCRnIntEnable            = 1,                            /* bit number of interrupt disable*/
  132.     mATADCROne                    = 1 << bATADCROne,                /* always one bit*/
  133.     mATADCRReset                = 1 << bATADCRReset,            /* Reset (1 = reset)*/
  134.     mATADCRnIntEnable            = 1 << bATADCRnIntEnable        /* Interrupt Disable(0 = enabled)*/
  135. };
  136.  
  137. /* ATA Command Opcode definition*/
  138.  
  139. enum {
  140.     kATAcmdWORetry                = 0x01,                            /* Without I/O retry option*/
  141.     kATAcmdNOP                    = 0x0000,                        /* NOP operation - media detect*/
  142.     kATAcmdRecal                = 0x0010,                        /* Recalibrate command */
  143.     kATAcmdRead                    = 0x0020,                        /* Read command */
  144.     kATAcmdReadLong                = 0x0022,                        /* Read Long command*/
  145.     kATAcmdWrite                = 0x0030,                        /* Write command */
  146.     kATAcmdWriteLong            = 0x0032,                        /* Write Long*/
  147.     kATAcmdWriteVerify            = 0x003C,                        /* Write verify*/
  148.     kATAcmdReadVerify            = 0x0040,                        /* Read Verify command */
  149.     kATAcmdFormatTrack            = 0x0050,                        /* Format Track command */
  150.     kATAcmdSeek                    = 0x0070,                        /* Seek command */
  151.     kATAcmdDiagnostic            = 0x0090,                        /* Drive Diagnostic command */
  152.     kATAcmdInitDrive            = 0x0091,                        /* Init drive parameters command */
  153.     kATAcmdReadMultiple            = 0x00C4,                        /* Read multiple*/
  154.     kATAcmdWriteMultiple        = 0x00C5,                        /* Write multiple*/
  155.     kATAcmdSetRWMultiple        = 0x00C6,                        /* Set Multiple for Read/Write Multiple*/
  156.     kATAcmdReadDMA                = 0x00C8,                        /* Read DMA (with retries)*/
  157.     kATAcmdWriteDMA                = 0x00CA,                        /* Write DMA (with retries)*/
  158.     kATAcmdMCAcknowledge        = 0x00DB,                        /* Acknowledge media change - removable*/
  159.     kATAcmdDoorLock                = 0x00DE,                        /* Door lock*/
  160.     kATAcmdDoorUnlock            = 0x00DF,                        /* Door unlock*/
  161.     kATAcmdStandbyImmed            = 0x00E0,                        /* Standby Immediate*/
  162.     kATAcmdIdleImmed            = 0x00E1,                        /* Idle Immediate*/
  163.     kATAcmdStandby                = 0x00E2,                        /* Standby*/
  164.     kATAcmdIdle                    = 0x00E3,                        /* Idle*/
  165.     kATAcmdReadBuffer            = 0x00E4,                        /* Read sector buffer command */
  166.     kATAcmdCheckPowerMode        = 0x00E5,                        /* Check power mode command    <04/04/94>*/
  167.     kATAcmdSleep                = 0x00E6,                        /* Sleep*/
  168.     kATAcmdWriteBuffer            = 0x00E8,                        /* Write sector buffer command */
  169.     kATAcmdWriteSame            = 0x00E9,                        /* Write same data to multiple sectors*/
  170.     kATAcmdDriveIdentify        = 0x00EC,                        /* Identify Drive command */
  171.     kATAcmdMediaEject            = 0x00ED,                        /* Media Eject*/
  172.     kATAcmdSetFeatures            = 0x00EF                        /* Set Features*/
  173. };
  174.  
  175. /* Set feature command opcodes*/
  176.  
  177. enum {
  178.     kATAEnableWriteCache        = 0x02,                            /*        Enable write cache*/
  179.     kATASetTransferMode            = 0x03,                            /*        Set transfer mode*/
  180.     kATASetPIOMode                = 0x08,                            /*        PIO Flow Control Tx Mode bit*/
  181.     kATAEnableECC                = 0x88,                            /*        ECC enable*/
  182.     kATAEnableRetry                = 0x99,                            /*        Retry enable*/
  183.     kATAEnableReadAhead            = 0xAA                            /*        Read look-ahead enable*/
  184. };
  185.  
  186. /*
  187.   --------------------------------------------------------------------------------
  188.    enums for dealing with device IDs
  189. */
  190.  
  191.  
  192. enum {
  193.     kATABusIDMask                = 0x000000FF,
  194.     kATADeviceIDMask            = 0x0000FF00,
  195.     kATADeviceIDClippingMask    = 0x0000FFFF,
  196.     kMinBusID                    = 0x00000000,
  197.     kMaxBusID                    = 0x000000FE
  198. };
  199.  
  200.  
  201. enum {
  202.     kATAStartIterateDeviceID    = 0xFFFF,
  203.     kATAEndIterateDeviceID        = 0xFF
  204. };
  205.  
  206. /*--------------------------------------------------------------------------------*/
  207. /* Device Register Images  (8 bytes) */
  208. struct ataTaskFile {
  209.     UInt8                             ataTFFeatures;                /* <-> Error(R) or ataTFFeatures(W) register image */
  210.     UInt8                             ataTFCount;                    /* <-> Sector count/remaining */
  211.     UInt8                             ataTFSector;                /* <-> Sector start/finish */
  212.     UInt8                             ataTFReserved;                /* reserved                    */
  213.     UInt16                             ataTFCylinder;                /* <-> ataTFCylinder (Big endian) */
  214.     UInt8                             ataTFSDH;                    /* <-> ataTFSDH register image*/
  215.     UInt8                             ataTFCommand;                /* <-> Status(R) or Command(W) register image */
  216. };
  217. typedef struct ataTaskFile ataTaskFile;
  218.  
  219. /* ATA Manager Function Code Definition*/
  220.  
  221. enum {
  222.     kATAMgrNOP                    = 0x00,                            /* No Operation*/
  223.     kATAMgrExecIO                = 0x01,                            /* Execute ATA I/O*/
  224.     kATAMgrBusInquiry            = 0x03,                            /* Bus Inquiry*/
  225.     kATAMgrQRelease                = 0x04,                            /* I/O Queue Release*/
  226.     kATAMgrAbort                = 0x10,                            /* Abort command*/
  227.     kATAMgrBusReset                = 0x11,                            /* Reset ATA bus*/
  228.     kATAMgrRegAccess            = 0x12,                            /* Register Access*/
  229.     kATAMgrDriveIdentify        = 0x13,                            /* Drive Identify            <DP03/10/94>*/
  230.     kATAMgrDriverLoad            = 0x82,                            /* Load driver from either Media, ROM, etc.*/
  231.     kATAMgrDriveRegister        = 0x85,                            /* Register a driver        <4/18/94>*/
  232.     kATAMgrFindDriverRefnum        = 0x86,                            /* lookup a driver refnum    <4/18/94>*/
  233.     kATAMgrRemoveDriverRefnum    = 0x87,                            /* De-register a driver    <4/18/94>*/
  234.     kATAMgrModifyEventMask        = 0x88,                            /* Modify driver event mask*/
  235.     kATAMgrDriveEject            = 0x89,                            /* Eject the drive        <8/1/94>*/
  236.     kATAMgrGetDrvConfiguration    = 0x8A,                            /* Get device configuration    <8/6/94>*/
  237.     kATAMgrSetDrvConfiguration    = 0x8B,                            /* Set device configuration <8/6/94>*/
  238.     kATAMgrGetLocationIcon        = 0x8C,                            /* Get card location icon    <SM4>*/
  239.     kATAMgrManagerInquiry        = 0x90,                            /* Manager Inquiry*/
  240.     kATAMgrManagerInit            = 0x91,                            /* Manager initialization*/
  241.     kATAMgrManagerShutdown        = 0x92,                            /* Manager ShutDown*/
  242.                                                                 /* note: functions 0x93 to 0x97 are reserved*/
  243.     kATAMgrFindSpecialDriverRefnum = 0x98,                        /* lookup a driver refnum; driverloader,notify-all or ROM driver.*/
  244.     kATAMgrNextAvailable        = 0x99
  245. };
  246.  
  247. /* used in the ataDrvrFlags field for kATAMgrDriveRegister,kATAMgrRemoveDriverRefnum & kATAMgrFindSpecialDriverRefnum*/
  248.  
  249. enum {
  250.     kATANotifyAllDriver            = 0,                            /* Notify-All driver*/
  251.     kATADriverLoader            = 1,                            /* Driver loader driver        */
  252.     kATAROMDriver                = 2                                /* ROM driver*/
  253. };
  254.  
  255. /* 'ATAFlags' field of the PB header definition*/
  256.  
  257. enum {
  258.     bATAFlagUseConfigSpeed        = 15,                            /* bit number of use default speed flag*/
  259.     bATAFlagByteSwap            = 14,                            /* bit number of byte swap flag*/
  260.     bATAFlagIORead                = 13,                            /* bit number of I/O read flag*/
  261.     bATAFlagIOWrite                = 12,                            /* bit number of I/O write flag*/
  262.     bATAFlagImmediate            = 11,                            /* bit number of immediate flag*/
  263.     bATAFlagQLock                = 10,                            /* bit number of que lock on error*/
  264.     bATAFlagScatterGather1        = 9,                            /* bit number of scatter gather*/
  265.     bATAFlagScatterGather0        = 8,                            /* bit numbers of scatter gather*/
  266.     bATAFlagUseDMA                = 7,                            /* bit number of use DMA flag*/
  267.     bATAFlagProtocol1            = 5,                            /* bit number of scatter gather*/
  268.     bATAFlagProtocol0            = 4,                            /* bit numbers of protocol specifier*/
  269.     bATAFlagTFRead                = 3,                            /* bit number of register update*/
  270.     bATAFlagLEDEnable            = 0,                            /* bit number of LED enable*/
  271.     mATAFlagUseConfigSpeed        = 1 << bATAFlagUseConfigSpeed,
  272.     mATAFlagByteSwap            = 1 << bATAFlagByteSwap,        /* Swap data bytes (read - after; write - before)*/
  273.     mATAFlagIORead                = 1 << bATAFlagIORead,            /* Read (in) operation*/
  274.     mATAFlagIOWrite                = 1 << bATAFlagIOWrite,            /* Write (out) operation*/
  275.     mATAFlagImmediate            = 1 << bATAFlagImmediate,        /* Head of Que; Immediate operation*/
  276.     mATAFlagQLock                = 1 << bATAFlagQLock,            /* Manager queue lock on error (freeze the queue)*/
  277.     mATAFlagScatterGather1        = 1 << bATAFlagScatterGather1,
  278.     mATAFlagScatterGather0        = 1 << bATAFlagScatterGather0,    /* Scatter gather enable*/
  279.     mATAFlagScatterGathers        = mATAFlagScatterGather1 + mATAFlagScatterGather0, /* host scatter gather type = currently type 1 supported*/
  280.     mATAFlagUseDMA                = 1 << bATAFlagUseDMA,
  281.     mATAFlagProtocol1            = 1 << bATAFlagProtocol1,        /* ATAPI protocol indicator <06/15/94>*/
  282.     mATAFlagProtocol0            = 1 << bATAFlagProtocol0,        /* PCMCIA protocol indicator <06/15/94>*/
  283.     mATAFlagProtocols            = mATAFlagProtocol1 + mATAFlagProtocol0, /* mask for protocol type field    <06/15/94>*/
  284.     mATAFlagTFRead                = 1 << bATAFlagTFRead,            /* update reg block request upon detection of an error*/
  285.     mATAFlagLEDEnable            = 1 << bATAFlagLEDEnable        /* socket LED enable*/
  286. };
  287.  
  288.  
  289. struct ataPBHeader {
  290.                                                                 /* Start of cloned common header ataPBHdr */
  291.     struct ataPBHeader *            ataPBLink;                    /* a pointer to the next entry in the queue    */
  292.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  293.     UInt8                             ataPBVers;                    /* -->: parameter block version number*/
  294.     UInt8                             ataPBReserved;                /* Reserved                                        */
  295.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  296.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  297.     OSErr                             ataPBResult;                /* <--: Returned result                */
  298.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  299.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  300.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  301.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  302.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  303.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  304.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  305.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  306.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  307.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  308.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  309.                                                                 /* End of cloned common header ataPBHdr*/
  310. };
  311. typedef struct ataPBHeader ataPBHeader;
  312.  
  313. /* data request entry structure (16 bytes)*/
  314. struct IOBlock {
  315.     UInt8 *                            ataPBBuffer;                /* -->: Data buffer pointer*/
  316.     UInt32                             ataPBByteCount;                /* -->: Data transfer length in bytes*/
  317. };
  318. typedef struct IOBlock IOBlock;
  319.  
  320. /*
  321.    For ATAPI devices the ExtendedPB field is a pointer to the Command Packet
  322.    record which exists of an array of words structured as follows…    <06/15/94>
  323. */
  324. struct ATAPICmdPacket {
  325.     SInt16                             atapiPacketSize;            /* Size of command packet in bytes    <06/15/94>*/
  326.     SInt16                             atapiCommandByte[8];        /* The command packet itself    <06/15/94>*/
  327. };
  328. typedef struct ATAPICmdPacket ATAPICmdPacket;
  329.  
  330. /* Manager parameter block structure (96 bytes)*/
  331. struct ataIOPB {
  332.                                                                 /* Start of cloned common header ataPBHdr*/
  333.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  334.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  335.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  336.     UInt8                             ataPBReserved;                /* Reserved                                        */
  337.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  338.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  339.     OSErr                             ataPBResult;                /* <--: Returned result                */
  340.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  341.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  342.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  343.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  344.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  345.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  346.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  347.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  348.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  349.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  350.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  351.                                                                 /* End of cloned common header ataPBHdr*/
  352.     SInt8                             ataPBStatusRegister;        /* <--: Last ATA status image*/
  353.     SInt8                             ataPBErrorRegister;            /* <--: Last ATA error image-valid if lsb of Status set*/
  354.     SInt16                             ataPBReserved5;                /* Reserved*/
  355.     UInt32                             ataPBLogicalBlockSize;        /* -->: Blind transfer size per interrupt (Logical block size)*/
  356.     UInt8 *                            ataPBBuffer;                /* -->: Data buffer pointer*/
  357.     UInt32                             ataPBByteCount;                /* -->: Data transfer length in bytes*/
  358.     UInt32                             ataPBActualTxCount;            /* <--: Actual transfer count*/
  359.     UInt32                             ataPBReserved6;                /* Reserved*/
  360.     ataTaskFile                     ataPBTaskFile;                /* <->:    Device register images*/
  361.     ATAPICmdPacket *                ataPBPacketPtr;                /* -->: ATAPI packet command block pointer (valid with ATAPI bit set)*/
  362.     SInt16                             ataPBReserved7[6];            /* Reserved for future expansion*/
  363. };
  364. typedef struct ataIOPB ataIOPB;
  365.  
  366. /* Parameter block structure for bus and Manager inquiry command*/
  367. /* Manager parameter block structure*/
  368. struct ataBusInquiry {
  369.                                                                 /* Start of cloned common header ataPBHdr*/
  370.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  371.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  372.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  373.     UInt8                             ataPBReserved;                /* Reserved                                        */
  374.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  375.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  376.     OSErr                             ataPBResult;                /* <--: Returned result                */
  377.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  378.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  379.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  380.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  381.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  382.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  383.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  384.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  385.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  386.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  387.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  388.                                                                 /* End of cloned common header ataPBHdr*/
  389.     UInt16                             ataEngineCount;                /* <--: TBD; zero for now*/
  390.     UInt16                             ataReserved1;                /* Reserved*/
  391.     UInt32                             ataDataTypes;                /* <--: TBD; zero for now*/
  392.     UInt16                             ataIOpbSize;                /* <--: Size of ATA IO PB*/
  393.     UInt16                             ataMaxIOpbSize;                /* <--: TBD; zero for now*/
  394.     UInt32                             ataFeatureFlags;            /* <--: TBD*/
  395.     UInt8                             ataVersionNum;                /* <--: Version number for the HBA*/
  396.     UInt8                             ataHBAInquiry;                /* <--: TBD; zero for now*/
  397.     UInt16                             ataReserved2;                /* Reserved*/
  398.     UInt32                             ataHBAPrivPtr;                /* <--: Ptr to HBA private data area*/
  399.     UInt32                             ataHBAPrivSize;                /* <--: Size of HBA private data area*/
  400.     UInt32                             ataAsyncFlags;                /* <--: Event capability for callback*/
  401.     UInt8                             ataPIOModes;                /* <--: PIO modes supported (bit-significant)*/
  402.     UInt8                             ataReserved3;                /* Reserved*/
  403.     UInt8                             ataSingleDMAModes;            /* <--: Single Word DMA modes supported (b-sig)    */
  404.     UInt8                             ataMultiDMAModes;            /* <--: Multiword DMA modes supported (b-sig)*/
  405.     UInt32                             ataReserved4[4];            /* Reserved*/
  406.     SInt8                             ataReserved5[16];            /* TBD*/
  407.     SInt8                             ataHBAVendor[16];            /* <--: Vendor ID of the HBA*/
  408.     SInt8                             ataContrlFamily[16];        /* <--: Family of ATA Controller*/
  409.     SInt8                             ataContrlType[16];            /* <--: Model number of controller*/
  410.     SInt8                             ataXPTversion[4];            /* <--: version number of XPT*/
  411.     SInt8                             ataReserved6[4];            /* Reserved*/
  412.     NumVersion                         ataHBAversion;                /* <--: version number of HBA*/
  413.     UInt8                             ataHBAslotType;                /* <--: type of slot*/
  414.     UInt8                             ataHBAslotNum;                /* <--: slot number of the HBA*/
  415.     UInt16                             ataReserved7;                /* Reserved*/
  416.     UInt32                             ataReserved8;                /* Reserved*/
  417. };
  418. typedef struct ataBusInquiry ataBusInquiry;
  419.  
  420. /* Manager parameter block structure*/
  421. struct ataMgrInquiry {
  422.                                                                 /* Start of cloned common header ataPBHdr*/
  423.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  424.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  425.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  426.     UInt8                             ataPBReserved;                /* Reserved                                        */
  427.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  428.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  429.     OSErr                             ataPBResult;                /* <--: Returned result                */
  430.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  431.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  432.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  433.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  434.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  435.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  436.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  437.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  438.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  439.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  440.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  441.                                                                 /* End of cloned common header ataPBHdr*/
  442.     NumVersion                         ataMgrVersion;                /* Manager Version information*/
  443.     UInt8                             ataMgrPBVers;                /* <--: Manager PB version number supported*/
  444.     UInt8                             Reserved1;                    /* Reserved*/
  445.     UInt16                             ataBusCnt;                    /* <--: Number of ATA buses in the system*/
  446.     UInt16                             ataDevCnt;                    /* <--: Total number of ATA devices detected*/
  447.     UInt8                             ataPioModes;                /* <--: Maximum Programmed I/O speed mode supported*/
  448.     UInt8                             Reserved2;                    /* Reserved*/
  449.     UInt16                             ataIOClkResolution;            /* <--: IO Clock resolution in nsec (Not supported)*/
  450.     UInt8                             ataSingleDMAModes;            /* <--: Single Word DMA modes supported    */
  451.     UInt8                             ataMultiDMAModes;            /* <--: Multiword DMA modes supported*/
  452.     SInt16                             Reserved[16];                /* Reserved for future expansion*/
  453. };
  454. typedef struct ataMgrInquiry ataMgrInquiry;
  455.  
  456. /* Parameter block structure for Abort command*/
  457. /* Manager parameter block structure*/
  458. struct ataAbort {
  459.                                                                 /* Start of cloned common header ataPBHdr*/
  460.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  461.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  462.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  463.     UInt8                             ataPBReserved;                /* Reserved                                        */
  464.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  465.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  466.     OSErr                             ataPBResult;                /* <--: Returned result                */
  467.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  468.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  469.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  470.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  471.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  472.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  473.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  474.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  475.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  476.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  477.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  478.                                                                 /* End of cloned common header ataPBHdr*/
  479.     ataIOPB *                        ataAbortPB;                    /* -->: Parameter block to be aborted*/
  480.     SInt16                             Reserved[22];                /* Reserved for future expansion*/
  481. };
  482. typedef struct ataAbort ataAbort;
  483.  
  484. /* Manager parameter block structure*/
  485. struct ATAEventRec {
  486.     UInt16                             ataEventCode;                /* --> ATA event code*/
  487.     UInt16                             ataPhysicalID;                /* --> Physical drive reference*/
  488.     SInt32                             ataDrvrContext;                /* Context pointer saved by driver*/
  489.     UInt32                             ataMarker;                    /* Always 'LOAD'*/
  490.     UInt32                             ataEventRecVersion;            /* Version number of this data structure*/
  491.     UInt32                             ataDeviceType;                /* Device type on bus (valid for load driver only)*/
  492.     UInt16                             ataRefNum;                    /* RefNum of driver (valid for remove driver only)*/
  493. };
  494. typedef struct ATAEventRec ATAEventRec;
  495.  
  496. typedef ATAEventRec *                    ATAEventRecPtr;
  497. typedef CALLBACK_API( SInt16 , ATAClientProcPtr )(ATAEventRecPtr ataERPtr);
  498. typedef STACK_UPP_TYPE(ATAClientProcPtr)                         ATAClientUPP;
  499. enum { uppATAClientProcInfo = 0x000000E0 };                     /* pascal 2_bytes Func(4_bytes) */
  500. #define NewATAClientProc(userRoutine)                             (ATAClientUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppATAClientProcInfo, GetCurrentArchitecture())
  501. #define CallATAClientProc(userRoutine, ataERPtr)                 CALL_ONE_PARAMETER_UPP((userRoutine), uppATAClientProcInfo, (ataERPtr))
  502. /* Parameter block structure for Driver Register command*/
  503. /* Manager parameter block structure*/
  504. struct ataDrvrRegister {
  505.                                                                 /* Start of cloned common header ataPBHdr*/
  506.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  507.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  508.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  509.     UInt8                             ataPBReserved;                /* Reserved                                        */
  510.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  511.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  512.     OSErr                             ataPBResult;                /* <--: Returned result                */
  513.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  514.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  515.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  516.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  517.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  518.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  519.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  520.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  521.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  522.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  523.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  524.                                                                 /* End of cloned common header ataPBHdr*/
  525.     SInt16                             ataDrvrRefNum;                /* <->: Driver reference number*/
  526.     UInt16                             ataDrvrFlags;                /* -->: 1 = loader driver if ataPBDeviceID = -1 {PB2}*/
  527.     UInt16                             ataDeviceNextID;            /* <--: used to specified the next drive ID*/
  528.     SInt16                             ataDrvrLoadPriv;            /* Driver loader private storage*/
  529.     ATAClientUPP                     ataEventHandler;            /* <->: Pointer to ATA event callback routine {PB2}*/
  530.     SInt32                             ataDrvrContext;                /* <->: Context data saved by driver {PB2}*/
  531.     SInt32                             ataEventMask;                /* <->: Set to 1 for notification of event {PB2}*/
  532.     SInt16                             Reserved[14];                /* Reserved for future expansion - from [21] {PB2}*/
  533. };
  534. typedef struct ataDrvrRegister ataDrvrRegister;
  535.  
  536. /* Parameter block structure for Modify driver event mask command*/
  537. struct ataModifyEventMask {
  538.                                                                 /* Start of cloned common header ataPBHdr*/
  539.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  540.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  541.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  542.     UInt8                             ataPBReserved;                /* Reserved                                        */
  543.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  544.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  545.     OSErr                             ataPBResult;                /* <--: Returned result                */
  546.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  547.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  548.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  549.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  550.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  551.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  552.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  553.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  554.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  555.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  556.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  557.                                                                 /* End of cloned common header ataPBHdr*/
  558.     SInt32                             ataModifiedEventMask;        /* -->: new event mask value*/
  559.     SInt16                             Reserved[22];                /* Reserved for future expansion*/
  560. };
  561. typedef struct ataModifyEventMask ataModifyEventMask;
  562.  
  563. /* 'ataRegMask' field of the ataRegAccess definition*/
  564.  
  565. enum {
  566.     bATAAltSDevCValid            = 14,                            /* bit number of alternate status/device cntrl valid bit*/
  567.     bATAStatusCmdValid            = 7,                            /* bit number of status/command valid bit*/
  568.     bATASDHValid                = 6,                            /* bit number of ataTFSDH valid bit*/
  569.     bATACylinderHiValid            = 5,                            /* bit number of cylinder high valid bit*/
  570.     bATACylinderLoValid            = 4,                            /* bit number of cylinder low valid bit*/
  571.     bATASectorNumValid            = 3,                            /* bit number of sector number valid bit*/
  572.     bATASectorCntValid            = 2,                            /* bit number of sector count valid bit*/
  573.     bATAErrFeaturesValid        = 1,                            /* bit number of error/features valid bit*/
  574.     bATADataValid                = 0,                            /* bit number of data valid bit*/
  575.     mATAAltSDevCValid            = 1 << bATAAltSDevCValid,        /* alternate status/device control valid*/
  576.     mATAStatusCmdValid            = 1 << bATAStatusCmdValid,        /* status/command valid*/
  577.     mATASDHValid                = 1 << bATASDHValid,            /* ataTFSDH valid*/
  578.     mATACylinderHiValid            = 1 << bATACylinderHiValid,        /* cylinder high valid*/
  579.     mATACylinderLoValid            = 1 << bATACylinderLoValid,        /* cylinder low valid*/
  580.     mATASectorNumValid            = 1 << bATASectorNumValid,        /* sector number valid*/
  581.     mATASectorCntValid            = 1 << bATASectorCntValid,        /* sector count valid*/
  582.     mATAErrFeaturesValid        = 1 << bATAErrFeaturesValid,    /* error/features valid*/
  583.     mATADataValid                = 1 << bATADataValid            /* data valid*/
  584. };
  585.  
  586. /* Parameter block structure for device register access command*/
  587. union ataRegValueUnion {
  588.     UInt8                             ataByteRegValue;            /* <->: Byte register value read or to be written*/
  589.     UInt16                             ataWordRegValue;            /* <->: Word register value read or to be written*/
  590. };
  591. typedef union ataRegValueUnion ataRegValueUnion;
  592.  
  593. /* Manager parameter block structure*/
  594. struct ataRegAccess {
  595.                                                                 /* Start of cloned common header ataPBHdr*/
  596.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  597.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  598.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  599.     UInt8                             ataPBReserved;                /* Reserved                                        */
  600.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  601.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  602.     OSErr                             ataPBResult;                /* <--: Returned result                */
  603.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  604.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  605.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  606.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  607.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  608.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  609.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  610.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  611.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  612.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  613.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  614.                                                                 /* End of cloned common header ataPBHdr*/
  615.     UInt16                             ataRegSelect;                /* -->: Device Register Selector*/
  616.                                                                 /*            DataReg            0    */
  617.                                                                 /*            ErrorReg(R) or FeaturesReg(W)    1*/
  618.                                                                 /*            SecCntReg        2*/
  619.                                                                 /*            SecNumReg        3*/
  620.                                                                 /*            CylLoReg        4*/
  621.                                                                 /*            CylHiReg        5*/
  622.                                                                 /*            SDHReg            6*/
  623.                                                                 /*            StatusReg(R) or CmdReg(W)        7*/
  624.                                                                 /*            AltStatus(R) or DevCntr(W)    0E*/
  625.     ataRegValueUnion                 ataRegValue;
  626.                                                                 /* Following fields are valid only if ataRegSelect = 0xFFFF*/
  627.     UInt16                             ataRegMask;                    /* -->: mask for register(s) to update*/
  628.                                                                 /*        bit 0 : data register valid*/
  629.                                                                 /*        bit 1 : error/feaures register valid*/
  630.                                                                 /*        bit 2 : sector count register valid*/
  631.                                                                 /*        bit 3 : sector number register valid*/
  632.                                                                 /*        bit 4 : cylinder low register valid*/
  633.                                                                 /*        bit 5 : cylinder high register valid*/
  634.                                                                 /*        bit 6 : ataTFSDH register valid*/
  635.                                                                 /*        bit 7 : status/command register valid*/
  636.                                                                 /*        bits 8 - 13 : reserved (set to 0)*/
  637.                                                                 /*        bit 14: alternate status / device control reg valid*/
  638.                                                                 /*         bit 15: reserved (set to 0)*/
  639.     ataTaskFile                     ataRegisterImage;            /* <->: register images*/
  640.     UInt8                             ataAltSDevCReg;                /* <->: Alternate status(R) or Device Control(W) register image*/
  641.     UInt8                             Reserved3;                    /* Reserved*/
  642.     SInt16                             Reserved[16];                /* Reserved for future expansion*/
  643. };
  644. typedef struct ataRegAccess ataRegAccess;
  645.  
  646. /* Manager parameter block structure    <DP03/10/94>*/
  647. struct ataIdentify {
  648.                                                                 /* Start of cloned common header ataPBHdr*/
  649.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  650.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  651.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  652.     UInt8                             ataPBReserved;                /* Reserved                                        */
  653.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  654.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  655.     OSErr                             ataPBResult;                /* <--: Returned result                */
  656.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  657.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  658.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  659.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  660.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  661.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  662.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  663.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  664.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  665.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  666.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  667.                                                                 /* End of cloned common header ataPBHdr*/
  668.     UInt16                             Reserved1[4];                /* Reserved.  These are used internally by the Manager*/
  669.     UInt8 *                            ataPBBuffer;                /* Buffer for the identify data (512 bytes)*/
  670.     UInt16                             Reserved2[12];                /* Used internally by the ATA Manager*/
  671.     SInt16                             Reserved3[6];                /* Reserved for future expansion*/
  672. };
  673. typedef struct ataIdentify ataIdentify;
  674.  
  675. /* 'ataConfigSetting' field of the Get/Set Device Configuration definition <8/6/94>*/
  676.  
  677. enum {
  678.     ATAPIpacketDRQ_bit            = 6,                            /* bit number of ATAPI command packet DRQ option*/
  679.     ATAPIpacketDRQ                = 1 << ATAPIpacketDRQ_bit        /* ATAPI command packet DRQ option*/
  680. };
  681.  
  682. /* atapcValid field definition*/
  683.  
  684. enum {
  685.     bATApcAccessMode            = 0,
  686.     bATApcVcc                    = 1,
  687.     bATApcVpp1                    = 2,
  688.     bATApcVpp2                    = 3,
  689.     bATApcStatus                = 4,
  690.     bATApcPin                    = 5,
  691.     bATApcCopy                    = 6,
  692.     bATApcConfigIndex            = 7,
  693.     bATApcLockUnlock            = 15,
  694.     mATApcAccessMode            = 1 << bATApcAccessMode,
  695.     mATApcVcc                    = 1 << bATApcVcc,
  696.     mATApcVpp1                    = 1 << bATApcVpp1,
  697.     mATApcVpp2                    = 1 << bATApcVpp2,
  698.     mATApcStatus                = 1 << bATApcStatus,
  699.     mATApcPin                    = 1 << bATApcPin,
  700.     mATApcCopy                    = 1 << bATApcCopy,
  701.     mATApcConfigIndex            = 1 << bATApcConfigIndex,
  702.     mATApcLockUnlock            = 1 << bATApcLockUnlock
  703. };
  704.  
  705. /* Device physical type & socket type indicator definition*/
  706.  
  707. enum {
  708.     kATADeviceUnknown            = 0x00,                            /* no device or type undetermined*/
  709.     kATADeviceATA                = 0x01,                            /* traditional ATA protocol device <7/29/94>*/
  710.     kATADeviceATAPI                = 0x02,                            /* ATAPI protocol device    <7/29/94>*/
  711.     kATADeviceReserved            = 0x03                            /* reserved by Apple (was PCMCIA)*/
  712. };
  713.  
  714.  
  715. enum {
  716.     kATASocketInternal            = 0x01,                            /* Internal ATA socket*/
  717.     kATASocketMB                = 0x02,                            /* Media Bay socket*/
  718.     kATASocketPCMCIA            = 0x03                            /* PCMCIA socket*/
  719. };
  720.  
  721. /* reserved words at the end of the devConfig structure*/
  722.  
  723. enum {
  724.     kATAConfigReserved            = 7                                /* number of reserved words at the end*/
  725. };
  726.  
  727. /*
  728.    Get/Set Device Configuration parameter block structure <8/6/94>
  729.    Manager parameter block structure
  730. */
  731. struct ataDevConfiguration {
  732.                                                                 /* Start of cloned common header ataPBHdr*/
  733.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  734.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  735.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  736.     UInt8                             ataPBReserved;                /* Reserved                                        */
  737.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  738.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  739.     OSErr                             ataPBResult;                /* <--: Returned result                */
  740.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  741.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  742.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  743.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  744.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  745.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  746.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  747.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  748.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  749.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  750.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  751.                                                                 /* End of cloned common header ataPBHdr*/
  752.     SInt32                             ataConfigSetting;            /* <->: Configuration setting*/
  753.                                                                 /*      Bits 3 - 0: Reserved*/
  754.                                                                 /*      Bit 4: Reserved (allowLBAAccess)*/
  755.                                                                 /*      Bit 5: Reserved (allowRWMultiple)*/
  756.                                                                 /*      Bit 6: ATAPIpacketDRQ*/
  757.                                                                 /*        1 = Check for Interrupt DRQ on ATAPI command packet DRQ*/
  758.                                                                 /*        0 = Default: Check only for the assertion of command packet DRQ*/
  759.                                                                 /*      Bits 31 - 7: Reserved*/
  760.     UInt8                             ataPIOSpeedMode;            /* <->: Device access speed in PIO Mode*/
  761.     UInt8                             Reserved3;                    /* Reserved to force word alignment*/
  762.     UInt16                             atapcValid;                    /* <->: Set when pcXXX fields are valid (atapcAccessMode - atapcConfigIndex)*/
  763.                                                                 /*        bit 0 - atapcAccessMode field valid, when set*/
  764.                                                                 /*        bit 1 - atapcVcc field valid, when set*/
  765.                                                                 /*        bit 2 - atapcVpp1 field valid, when set*/
  766.                                                                 /*        bit 3 - atapcVpp2 field valid, when set*/
  767.                                                                 /*        bit 4 - atapcStatus field valid, when set*/
  768.                                                                 /*        bit 5 - atapcPin field valid, when set*/
  769.                                                                 /*        bit 6 - atapcCopy field valid, when set*/
  770.                                                                 /*        bit 7 - atapcConfigIndex field valid, when set*/
  771.                                                                 /*        bits 14-8 - Reserved*/
  772.                                                                 /*        bit 15 - device lock/unlock request (write only)*/
  773.     UInt16                             ataRWMultipleCount;            /* Reserved for future (not supported yet)*/
  774.     UInt16                             ataSectorsPerCylinder;        /* Reserved for future (not supported yet)*/
  775.     UInt16                             ataHeads;                    /* Reserved for future (not supported yet)*/
  776.     UInt16                             ataSectorsPerTrack;            /* Reserved for future (not supported yet)*/
  777.     UInt16                             ataSocketNumber;            /* <--: Socket number used by the CardServices*/
  778.                                                                 /*        0xFF = socket number invalid (Not a CardServices device)*/
  779.                                                                 /*        other = socket number of the device*/
  780.     UInt8                             ataSocketType;                /* <--: Specifies the socket type (get config only)*/
  781.                                                                 /*        00 = Unknown socket*/
  782.                                                                 /*         01 = Internal ATA bus*/
  783.                                                                 /*        02 = Media Bay*/
  784.                                                                 /*        03 = PCMCIA*/
  785.     UInt8                             ataDeviceType;                /* <--: Specifies the device type (get config only)*/
  786.                                                                 /*        00 = Unknown device*/
  787.                                                                 /*        01 = standard ATA device (HD)*/
  788.                                                                 /*        02 = ATAPI device*/
  789.                                                                 /*        03 = PCMCIA ATA device*/
  790.     UInt8                             atapcAccessMode;            /* <->: Access mode: Memory vs. I/O (PCMCIA only)*/
  791.     UInt8                             atapcVcc;                    /* <->: Voltage in tenths of a volt (PCMCIA only)*/
  792.     UInt8                             atapcVpp1;                    /* <->: Voltage in tenths of a volt (PCMCIA only)*/
  793.     UInt8                             atapcVpp2;                    /* <->: Voltage in tenths of a volt (PCMCIA only)*/
  794.     UInt8                             atapcStatus;                /* <->: Card Status register setting (PCMCIA only)*/
  795.     UInt8                             atapcPin;                    /* <->: Card Pin register setting (PCMCIA only)*/
  796.     UInt8                             atapcCopy;                    /* <->: Card Socket/Copy register setting (PCMCIA only)*/
  797.     UInt8                             atapcConfigIndex;            /* <->: Card Option register setting (PCMCIA only)*/
  798.     UInt8                             ataSingleDMASpeed;            /* <->: Single Word DMA Timing Class*/
  799.     UInt8                             ataMultiDMASpeed;            /* <->: Multiple Word DMA Timing Class*/
  800.     UInt16                             ataPIOCycleTime;            /* <->:Cycle time for PIO mode*/
  801.     UInt16                             ataMultiCycleTime;            /* <->:Cycle time for Multiword DMA mode*/
  802.     UInt16                             Reserved1[7];                /* Reserved for future*/
  803. };
  804. typedef struct ataDevConfiguration ataDevConfiguration;
  805.  
  806. /* Get Card Location Icon/Text    <SM4>*/
  807.  
  808. enum {
  809.     kATALargeIconHFS            = 0x0001,                        /* Large B&W icon with mask (HFS)*/
  810.     kATALargeIconProDOS            = 0x0081                        /* Large B&W icon with mask (ProDOS)*/
  811. };
  812.  
  813. /* Manager parameter block structure*/
  814. struct ataLocationData {
  815.                                                                 /* Start of cloned common header ataPBHdr*/
  816.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  817.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  818.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  819.     UInt8                             ataPBReserved;                /* Reserved                                        */
  820.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  821.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  822.     OSErr                             ataPBResult;                /* <--: Returned result                */
  823.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  824.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  825.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  826.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  827.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  828.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  829.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  830.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  831.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  832.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  833.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  834.                                                                 /* End of cloned common header ataPBHdr*/
  835.     SInt16                             ataIconType;                /* -->: icon type specifier*/
  836.                                                                 /*         1 = Large B&W icon with mask (256 bytes)*/
  837.                                                                 /*        0x81 = Same as 1, but ProDOS icon*/
  838.     SInt16                             ataIconReserved;            /* Reserved to be longword aligned*/
  839.     SInt8 *                            ataLocationIconPtr;            /* -->: Icon Data buffer pointer*/
  840.     SInt8 *                            ataLocationStringPtr;        /* -->: Icon String buffer pointer*/
  841.     UInt16                             Reserved1[18];                /* Reserved for future*/
  842. };
  843. typedef struct ataLocationData ataLocationData;
  844.  
  845. /* ataOSType available*/
  846.  
  847. enum {
  848.     kATAddTypeMacOS                = 0x0001                        /* Blue Mac O/S ddType value*/
  849. };
  850.  
  851. /* The parameter block definition for all other ATA Manager functions.*/
  852.  
  853. struct ataGeneric {
  854.                                                                 /* Start of cloned common header ataPBHdr*/
  855.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  856.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  857.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  858.     UInt8                             ataPBReserved;                /* Reserved                                        */
  859.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  860.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  861.     OSErr                             ataPBResult;                /* <--: Returned result                */
  862.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  863.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  864.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  865.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  866.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  867.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  868.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  869.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  870.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  871.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  872.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  873.                                                                 /* End of cloned common header ataPBHdr*/
  874.     UInt16                             Reserved[24];                /* Reserved for future*/
  875. };
  876. typedef struct ataGeneric ataGeneric;
  877.  
  878. union ataPB {
  879.     ataIOPB                         ataIOParamBlock;            /* parameter block for I/O*/
  880.     ataBusInquiry                     ataBIParamBlock;            /* parameter block for bus inquiry*/
  881.     ataMgrInquiry                     ataMIParamBlock;            /* parameter block for Manager inquiry*/
  882.     ataAbort                         ataAbortParamBlock;            /* parameter block for abort*/
  883.     ataDrvrRegister                 ataDRParamBlock;            /* parameter block for driver register*/
  884.     ataModifyEventMask                 ataMEParamBlock;            /* parameter block for event mask modify*/
  885.     ataRegAccess                     ataRAParamBlock;            /* parameter block for register access*/
  886.     ataIdentify                     ataDIParamBlock;            /* parameter block for drive identify*/
  887.     ataDevConfiguration             ataDCParamBlock;            /* parameter block for device configuration*/
  888.     ataLocationData                 ataLDParamBlock;            /* parameter block for location icon data*/
  889.                                                                 /*ataManagerInit    ataInitParamBlock;        // parameter block for Manager initialization*/
  890.                                                                 /*ataManagerShutDn    ataSDParamBlock;        // parameter block for Manager shutdown*/
  891.                                                                 /*ataDrvrLoad        ataDLParamBlock;        // parameter block for Driver loading*/
  892.     ataGeneric                         ataGenericParamBlock;        /* parameter block for all other functions*/
  893. };
  894. typedef union ataPB ataPB;
  895.  
  896. /* The ATA Event codes…*/
  897.  
  898. enum {
  899.     kATANullEvent                = 0x00,                            /* Just kidding -- nothing happened*/
  900.     kATAOnlineEvent                = 0x01,                            /* An ATA device has come online*/
  901.     kATAOfflineEvent            = 0x02,                            /* An ATA device has gone offline*/
  902.     kATARemovedEvent            = 0x03,                            /* An ATA device has been removed from the bus*/
  903.     kATAResetEvent                = 0x04,                            /* Someone gave a hard reset to the drive*/
  904.     kATAOfflineRequest            = 0x05,                            /* Someone requesting to offline the drive*/
  905.     kATAEjectRequest            = 0x06,                            /* Someone requesting to eject the drive*/
  906.     kATAUpdateEvent                = 0x07,                            /* Potential configuration change reported by CardServices <SM4>*/
  907.     kATATaskTimeRequest            = 0x08,                            /* The manager is requesting to be called at Task Time*/
  908.     kATALoadDriverNow            = 0x09,                            /* Load the driver for the given bus immediately*/
  909.                                                                 /* The following describes bit definitions in the eventMask field of ataDrvrRegister*/
  910.     bATANullEvent                = 1 << kATANullEvent,            /* null event bit*/
  911.     bATAOnlineEvent                = 1 << kATAOnlineEvent,            /* online event bit*/
  912.     bATAOfflineEvent            = 1 << kATAOfflineEvent,        /* offline event bit*/
  913.     bATARemovedEvent            = 1 << kATARemovedEvent,        /* removed event bit*/
  914.     bATAResetEvent                = 1 << kATAResetEvent,            /* reset event bit*/
  915.     bATAOfflineRequest            = 1 << kATAOfflineRequest,        /* offline request event bit*/
  916.     bATAEjectRequest            = 1 << kATAEjectRequest,        /* eject request event bit*/
  917.     bATAUpdateEvent                = 1 << kATAUpdateEvent            /* configuration update event bit*/
  918. };
  919.  
  920.  
  921. enum {
  922.     kATAEventMarker                = FOUR_CHAR_CODE('LOAD'),        /* Marker for the event data structure*/
  923.     kATAEventVersion1            = 0x00000001                    /* Version 1 of the event structure*/
  924. };
  925.  
  926. typedef CALLBACK_API( OSErr , ATADispatchProcPtr )(ataPB *pb);
  927. typedef STACK_UPP_TYPE(ATADispatchProcPtr)                         ATADispatchUPP;
  928. enum { uppATADispatchProcInfo = 0x000000E0 };                     /* pascal 2_bytes Func(4_bytes) */
  929. #define NewATADispatchProc(userRoutine)                         (ATADispatchUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppATADispatchProcInfo, GetCurrentArchitecture())
  930. #define CallATADispatchProc(userRoutine, pb)                     CALL_ONE_PARAMETER_UPP((userRoutine), uppATADispatchProcInfo, (pb))
  931. EXTERN_API( SInt16 )
  932. ataManager                        (ataPB *                pb)                                    ONEWORDINLINE(0xAAF1);
  933.  
  934. /* Device Error codes: 0xDB42 - 0xDB5F    */
  935.  
  936.  
  937. enum {
  938.     ATABaseErrCode                = -9406,                        /* Base error code - 0xDB42    */
  939.     ioPending                    = 1,                            /* Asynch I/O in progress status*/
  940.     AT_NRdyErr                    = ATABaseErrCode + 0x01,        /* 0xDB43: Drive not Ready */
  941.     AT_IDNFErr                    = ATABaseErrCode + 0x02,        /* 0xDB44: ID not found */
  942.     AT_DMarkErr                    = ATABaseErrCode + 0x03,        /* 0xDB45: Data mark not found */
  943.     AT_BadBlkErr                = ATABaseErrCode + 0x04,        /* 0xDB46: Bad Block */
  944.     AT_CorDataErr                = ATABaseErrCode + 0x05,        /* 0xDB47: Data was corrected */
  945.     AT_UncDataErr                = ATABaseErrCode + 0x06,        /* 0xDB48: Data was not corrected */
  946.     AT_SeekErr                    = ATABaseErrCode + 0x07,        /* 0xDB49: Seek error */
  947.     AT_WrFltErr                    = ATABaseErrCode + 0x08,        /* 0xDB4A: Write fault */
  948.     AT_RecalErr                    = ATABaseErrCode + 0x09,        /* 0xDB4B: Recalibrate failed */
  949.     AT_AbortErr                    = ATABaseErrCode + 0x0A,        /* 0xDB4C: Command aborted by drive */
  950.     AT_MCErr                    = ATABaseErrCode + 0x0C,        /* 0xDB4E: Media Changed error*/
  951.     ATAPICheckErr                = ATABaseErrCode + 0x0D,        /* 0xDB4F: ATAPI Check condition <06/15/94>*/
  952.                                                                 /* System error codes...Custom Driver Error Codes 0xDB60 - 0xDB6F*/
  953.     DRVRCantAllocate            = ATABaseErrCode + 0x1E,        /* 0xDB60: Allocation error during initialization*/
  954.     NoATAMgr                    = ATABaseErrCode + 0x1F,        /* 0xDB61: MgrInquiry failed => No ATA Manager*/
  955.     ATAInitFail                    = ATABaseErrCode + 0x20,        /* 0xDB62: Mgr Initialization failed*/
  956.     ATABufFail                    = ATABaseErrCode + 0x21,        /* 0xDB63: Device buffer test failure*/
  957.     ATADevUnsupported            = ATABaseErrCode + 0x22,        /* 0xDB64: Device type not supported*/
  958.     ATAEjectDrvErr                = ATABaseErrCode + 0x23,        /* 0xDB65: Could not eject the drive*/
  959.                                                                 /* Manager Error Codes 0xDB70 - 0xDB8F*/
  960.     ATAMgrNotInitialized        = ATABaseErrCode + 0x2E,        /* 0xDB70: Mgr has not been initialized*/
  961.     ATAPBInvalid                = ATABaseErrCode + 0x2F,        /* 0xDB71: The bus base address couldn't be found*/
  962.     ATAFuncNotSupported            = ATABaseErrCode + 0x30,        /* 0xDB72: An unknown function code specified*/
  963.     ATABusy                        = ATABaseErrCode + 0x31,        /* 0xDB73: Selected device is busy*/
  964.     ATATransTimeOut                = ATABaseErrCode + 0x32,        /* 0xDB74: Transaction timeout detected*/
  965.     ATAReqInProg                = ATABaseErrCode + 0x33,        /* 0xDB75: Channel busy; channel is processing another cmd*/
  966.     ATAUnknownState                = ATABaseErrCode + 0x34,        /* 0xDB76: Device status register reflects an unknown state*/
  967.     ATAQLocked                    = ATABaseErrCode + 0x35,        /* 0xDB77: I/O Queue is locked due to previous I/O error.*/
  968.     ATAReqAborted                = ATABaseErrCode + 0x36,        /* 0xDB78: The I/O queue entry was aborted due to an abort req.*/
  969.                                                                 /*            or due to Manager shutdown.*/
  970.     ATAUnableToAbort            = ATABaseErrCode + 0x37,        /* 0xDB79: The I/O queue entry could not be aborted.*/
  971.     ATAAbortedDueToRst            = ATABaseErrCode + 0x38,        /* 0xDB7A: Request aborted due to a device reset command.*/
  972.     ATAPIPhaseErr                = ATABaseErrCode + 0x39,        /* 0xDB7B: Unexpected phase - •••IS THIS VALID ERROR??? <06/15/94>*/
  973.     ATAPITxCntErr                = ATABaseErrCode + 0x3A,        /* 0xDB7C: Overrun/Underrun condition detected*/
  974.     ATANoClientErr                = ATABaseErrCode + 0x3B,        /* 0xDB7D: No client present to handle the event*/
  975.     ATAInternalErr                = ATABaseErrCode + 0x3C,        /* 0xDB7E: MagnumOpus returned an error*/
  976.     ATABusErr                    = ATABaseErrCode + 0x3D,        /* 0xDB7F: Bus error detected on I/O    */
  977.     AT_NoAddrErr                = ATABaseErrCode + 0x3E,        /* 0xDB80: Invalid AT base adress */
  978.     DriverLocked                = ATABaseErrCode + 0x3F,        /* 0xDB81: Current driver must be removed before adding another*/
  979.     CantHandleEvent                = ATABaseErrCode + 0x40,        /* 0xDB82: Particular event couldn't be handled (call others)*/
  980.     ATAMgrMemoryErr                = ATABaseErrCode + 0x41,        /* 0xDB83: Manager memory allocation error    */
  981.     ATASDFailErr                = ATABaseErrCode + 0x42,        /* 0xDB84: Shutdown failure                */
  982.     ATAXferParamErr                = ATABaseErrCode + 0x43,        /* 0xDB85: I/O xfer parameters inconsistent */
  983.     ATAXferModeErr                = ATABaseErrCode + 0x44,        /* 0xDB86: I/O xfer mode not supported */
  984.     ATAMgrConsistencyErr        = ATABaseErrCode + 0x45,        /* 0XDB87: Manager detected internal inconsistency. */
  985.     ATADmaXferErr                = ATABaseErrCode + 0x46,        /* 0XDB88: fatal error in DMA side of transfer */
  986.                                                                 /* Driver loader error Codes 0xDB90 - 0xDBA5*/
  987.     ATAInvalidDrvNum            = ATABaseErrCode + 0x4E,        /* 0xDB90: Invalid drive number from event*/
  988.     ATAMemoryErr                = ATABaseErrCode + 0x4F,        /* 0xDB91: Memory allocation error*/
  989.     ATANoDDMErr                    = ATABaseErrCode + 0x50,        /* 0xDB92: No DDM found on media    */
  990.     ATANoDriverErr                = ATABaseErrCode + 0x51            /* 0xDB93: No driver found on the media    */
  991. };
  992.  
  993. /* ------------------------    Version 1 definition -------------------------------    */
  994.  
  995. enum {
  996.     v1ATABaseErrCode            = 0x0700,                        /* This needs a home somewhere*/
  997.     v1AT_NRdyErr                = 0x01 - v1ATABaseErrCode,        /* 0xF901: -0x1DBE */
  998.     v1AT_IDNFErr                = 0x04 - v1ATABaseErrCode,        /* 0xF904: -0x1DC0 */
  999.     v1AT_DMarkErr                = 0x05 - v1ATABaseErrCode,        /* 0xF905: -0x1DC0 */
  1000.     v1AT_BadBlkErr                = 0x06 - v1ATABaseErrCode,        /* 0xF906: -0x1DC0 */
  1001.     v1AT_CorDataErr                = 0x07 - v1ATABaseErrCode,        /* 0xF907: -0x1DC0 */
  1002.     v1AT_UncDataErr                = 0x08 - v1ATABaseErrCode,        /* 0xF908: -0x1DC0 */
  1003.     v1AT_SeekErr                = 0x09 - v1ATABaseErrCode,        /* 0xF909: -0x1DC0 */
  1004.     v1AT_WrFltErr                = 0x0A - v1ATABaseErrCode,        /* 0xF90A: -0x1DC0 */
  1005.     v1AT_RecalErr                = 0x0B - v1ATABaseErrCode,        /* 0xF90B: -0x1DC0 */
  1006.     v1AT_AbortErr                = 0x0C - v1ATABaseErrCode,        /* 0xF90C: -0x1DC0 */
  1007.     v1AT_NoAddrErr                = 0x0D - v1ATABaseErrCode,        /* 0xF90D: -0x1D8D */
  1008.     v1AT_MCErr                    = 0x0E - v1ATABaseErrCode,        /* 0xF90E: -0x1DC0*/
  1009.                                                                 /* System error codes...Custom Driver Error Codes*/
  1010.     v1DRVRCantAllocate            = -(v1ATABaseErrCode + 1),        /* 0xF8FF: -0x1D9F*/
  1011.     v1NoATAMgr                    = -(v1ATABaseErrCode + 2),        /* 0xF8FE: -0x1D9D*/
  1012.     v1ATAInitFail                = -(v1ATABaseErrCode + 3),        /* 0xF8FD: -0x1D9B*/
  1013.     v1ATABufFail                = -(v1ATABaseErrCode + 4),        /* 0xF8FC: -0x1D99*/
  1014.     v1ATADevUnsupported            = -(v1ATABaseErrCode + 5),        /* 0xF8FB: -0x1c97*/
  1015.                                                                 /* Manager Error Codes*/
  1016.     v1ATAMgrNotInitialized        = -(v1ATABaseErrCode + 10),        /* 0xF8F6: -0x1D86*/
  1017.     v1ATAPBInvalid                = -(v1ATABaseErrCode + 11),        /* 0xF8F5: -0x1D84*/
  1018.     v1ATAFuncNotSupported        = -(v1ATABaseErrCode + 12),        /* 0xF8F4: -0x1D82*/
  1019.     v1ATABusy                    = -(v1ATABaseErrCode + 13),        /* 0xF8F3: -0x1D80*/
  1020.     v1ATATransTimeOut            = -(v1ATABaseErrCode + 14),        /* 0xF8F2: -0x1D7E*/
  1021.     v1ATAReqInProg                = -(v1ATABaseErrCode + 15),        /* 0xF8F1: -0x1D7C*/
  1022.     v1ATAUnknownState            = -(v1ATABaseErrCode + 16),        /* 0xF8F0: -0x1D7A*/
  1023.     v1ATAQLocked                = -(v1ATABaseErrCode + 17),        /* 0xF8EF: -0x1D78*/
  1024.     v1ATAReqAborted                = -(v1ATABaseErrCode + 18),        /* 0xF8EE: -0x1D76*/
  1025.     v1ATAUnableToAbort            = -(v1ATABaseErrCode + 19),        /* 0xF8ED: -0x1D74*/
  1026.     v1ATAAbortedDueToRst        = -(v1ATABaseErrCode + 20)        /* 0xF8EC: -0x1D72*/
  1027. };
  1028.  
  1029.  
  1030.  
  1031. #if PRAGMA_STRUCT_ALIGN
  1032.     #pragma options align=reset
  1033. #elif PRAGMA_STRUCT_PACKPUSH
  1034.     #pragma pack(pop)
  1035. #elif PRAGMA_STRUCT_PACK
  1036.     #pragma pack()
  1037. #endif
  1038.  
  1039. #ifdef PRAGMA_IMPORT_OFF
  1040. #pragma import off
  1041. #elif PRAGMA_IMPORT
  1042. #pragma import reset
  1043. #endif
  1044.  
  1045. #ifdef __cplusplus
  1046. }
  1047. #endif
  1048.  
  1049. #endif /* __ATA__ */
  1050.  
  1051.